package mysql

import (
	"gorm.io/gorm"
	"yukao1/models/global"
	"yukao1/models/request"
)

type UserYk struct {
	gorm.Model
	Mobile    string `gorm:"type:char(11);comment:手机号;"`
	Password  string `gorm:"type:char(32);comment:密码;"`
	LoginType int    `gorm:"type:tinyint(1);comment:登录方式 0手机号 1微信 2微博 3iPhone;"`
}

// 用户登录
func UserLogin(data request.UserRequest) UserYk {
	var user UserYk
	global.DB.Where("mobile = ?", data.Mobile).Where("password = ?", data.Password).Find(&user)
	return user

}
